package com.study.bean;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.*;
import org.springframework.stereotype.Component;

/**
 * @Description TODO
 * @Author v_yangliu
 * @Date 2022/1/11 15:00
 * @Version 1.0
 **/
@Data
@Slf4j
/**
 * InitializingBean是在bean容器化之后执行的
 * DisposableBean是在bean初始化之前执行的
 * BeanNameAware是在DisposableBean实例之前执行的
 * BeanFactoryAware是InitializingBean之前实例之前执行的
 */
public class BeanFactoryPostProcessorTest implements InitializingBean, DisposableBean, BeanNameAware, BeanFactoryAware {
    private String name;
    private String sex;
    @Override
    public void setBeanFactory(BeanFactory paramBeanFactory)
            throws BeansException {
        log.info("》》》调用了BeanFactoryAware的setBeanFactory方法了{}",paramBeanFactory);
    }

    @Override
    public void setBeanName(String paramString) {
        log.info("》》》调用了BeanNameAware的setBeanName方法了{}",paramString);
    }

    @Override
    public void destroy() throws Exception {
        log.info("》》》调用了DisposableBean的destroy方法了");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        log.info("》》》调用了Initailization的afterPropertiesSet方法了");
    }

}
